const baseUrl = 'https://www.yangaoyuan.cn';

const request = (url,query)=>{
    let Url = baseUrl + url;
    return new Promise((resolve,reject) =>{
        wx.request({
            url:Url,
            data:query,
            method:"get",
            header:{
                'content-type': 'application/json' // 默认值
            },
            success(req){
                resolve(req.data);
            },
            fail(err){
                reject(err);
            }
    })
})
};

let getHotSearch = (query)=>{
    return request('/search/hot',query)  //热搜接口
};

let getBanner = (query)=>{
return request('/banner',query)  //个人推荐轮播接口
};

let getPlaylist = (query)=>{
    return request('/top/playlist',query)  //热门歌单接口
};
let getNewSong = (query)=>{
    return request('/personalized/newsong',query) //最新音乐接口
};
let getStation = (query) =>{
    return request('/dj/recommend',query);  //精选电台
};
let getNewAlbum = (query) =>{
    return request('/album/newest',query); //最新专辑
};
let getTodayPerfered = (query) =>{
    return request('/dj/today/perfered',query); //今日优选
};

let getHotStation = (query) =>{
    return request('/dj/radio/hot',query); //类别热门电台
};

let getLourList = (query) =>{
    return request('/dj/program/toplist/hours',query); //电台24小时节目榜参数limit控制数量
};
let getAnchorList = (query)=>{
    return request('/dj/toplist/hours',query); //电台24小时主播榜limit为返回参数
};
let getNewcomer = (query)=>{
    return request('/dj/toplist/newcomer',query); //电台主播新人榜limit为返回参数
}
let getPopularList = (query)=>{
    return request('/dj/toplist/popular',query); //电台最热主播榜limit为返回参数
}

let getNewMv = (query) =>{
        return request('/mv/first',query); //获取最新mv
}

let  getsearchRecommend = (query) =>{
    return request('/search/suggest',query); //搜索建议
}
let getSearchResult = (query)=>{
    return request('/cloudsearch',query);  //搜索结果
}
let getSingerTop = (query) =>{
    return request('/toplist/artist',query); //歌手榜
}

let getSheet = (query) =>{
    return request('/top/playlist',query); //精选歌单 limit请求数据量 offset用于分页
}

let getsheetList = (query)=>{
    return request('/playlist/detail',query); //精选歌单详情
}
let getreaking = (query)=>{
    return request('/toplist/detail',query); //榜单内容的摘要
}

let getcateList = (query)=>{
    return request('/dj/cateList',query)  //电台分类
}

let getPayList = (query)=>{
    return request('/dj/toplist/pay',query)  //付费精品
}


module.exports = {
    getHotSearch,
    getBanner,
    getPlaylist,
    getNewSong,
    getStation,
    getNewAlbum,
    getHotStation,
    getPayList,
    getLourList,
    getAnchorList,
    getNewcomer,
    getPopularList,
    getTodayPerfered,
    getNewMv,
    getsearchRecommend,
    getSearchResult,
    getSingerTop,
    getSheet,
    getsheetList,
    getreaking,
    getcateList,
}